

static int _menu_item_selected;
static int _menu_last_item_selected = 0;
static int _menu_item_focused;
static final int _menu_spacing = 5;
static final int _menu_title_y = 20;
static int _menu_x;
static int _menu_y;
// static Font _menu_font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_LARGE);

static int[] menu_main = 
{
	TEXT.MENU_MAIN_MENU,
	TEXT.MENU_NEW_GAME,
	TEXT.MENU_SELECT_LEVEL,
	TEXT.MENU_OPTIONS,
	TEXT.MENU_ABOUT,
	TEXT.MENU_HELP,
	TEXT.MENU_EXIT,
};
static void Update_MainMenu_Selected()
{
	switch(_menu_item_selected)
	{
		case TEXT.MENU_NEW_GAME:
			System.out.println(">>>>>>>>>>>> Selecet Button "+GetString(TEXT.MENU_NEW_GAME));
			SwitchState(STATE_GAMEPLAY);
			break;
		case TEXT.MENU_OPTIONS:
			System.out.println(">>>>>>>>>>>> Selecet Button "+GetString(TEXT.MENU_OPTIONS));
			SwitchState(STATE_SELECTLANGUAGE);
			break;
		case TEXT.MENU_ABOUT:
			System.out.println(">>>>>>>>>>>> Selecet Button "+GetString(TEXT.MENU_ABOUT));
			break;
		case TEXT.MENU_SELECT_LEVEL:
			System.out.println(">>>>>>>>>>>> Selecet Button "+GetString(TEXT.MENU_SELECT_LEVEL));
			break;
		case TEXT.MENU_MAIN_MENU:
			System.out.println(">>>>>>>>>>>> Selecet Button "+GetString(TEXT.MENU_MAIN_MENU));
			break;
		case TEXT.MENU_EXIT:
			System.out.println(">>>>>>>>>>>> Selecet Button "+GetString(TEXT.MENU_EXIT));
			SwitchState(STATE_EXIT_CONFIRM);
			break;
		default:
			break;
	}
}
static void Update_MainMenu()
{
	switch(s_iPressedKey)
	{
		case CanvasKeys.NUM2:
		case CanvasKeys.UP:
			if(_menu_item_focused == 0)
				_menu_item_focused = menu_main.length-2;
			else
				_menu_item_focused --;
			break;
		case CanvasKeys.NUM8:
		case CanvasKeys.DOWN:
			if(_menu_item_focused == menu_main.length-2)
				_menu_item_focused = 0;
			else
				_menu_item_focused ++;
			break;
		case CanvasKeys.NUM5:
		case CanvasKeys.SELECT:
			break;
		default:
			break;
	}
	switch(s_iReleasedKey)
	{
		case CanvasKeys.NUM5:
		case CanvasKeys.SELECT:
			_menu_item_selected = menu_main[_menu_item_focused+1];
			Update_MainMenu_Selected();
			break;		
		case CanvasKeys.SK_RIGHT:
			if(softkeyRight)
			{
				_menu_item_selected = TEXT.MENU_EXIT;
				Update_MainMenu_Selected();
			}
			break;
		default:
			break;
	}
	
}

static void Paint_MainMenu(Graphics g)
{
	g.drawImage(imgMainMenuBG,0,0,0);
	DrawMenu(g, menu_main, false);
}


